﻿using System;
using UnityEngine;

namespace KuiHuaBaoDian.Services.Guide {

    public struct GuideReference {

        public object Target;
    }

    [Serializable]
    public struct GuideAnchor {

        public static readonly GuideAnchor Default = new() { X = 0.5f, Y = 0.5f };

        public float X;
        public float Y;

        public static implicit operator Vector2(GuideAnchor @in) => new(@in.X, @in.Y);

        public override readonly string ToString() {
            if (X == 0) {
                if (Y == 0) {
                    return "左下";
                } else if (Y == 0.5f) {
                    return "左侧";
                } else {
                    return "左上";
                }
            } else if (X == 0.5f) {
                if (Y == 0) {
                    return "底部";
                } else if (Y == 0.5f) {
                    return "中心";
                } else {
                    return "顶部";
                }
            } else {
                if (Y == 0) {
                    return "右下";
                } else if (Y == 0.5f) {
                    return "右侧";
                } else {
                    return "右上";
                }
            }
        }
    }
}
